﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Joyintech.DBUtility;
using Joyintech.IDAL.inpiao365;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using System.Data;

namespace Joyintech.SQL2008DAL.inpiao365
{
    public partial class systemArea_DAL : AbstractDAL, IsystemArea_DAL
    {

        public Model.inpiao365.systemArea GetModelByCode(int areacode)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select Id,Encode,Preencode,Name,Postcode,Areanumber,Remark,IsOpen from systemArea ");
            strSql.Append(" where Encode=@Encode ");
            Database db = this.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "Encode", DbType.String, areacode);
            Joyintech.Model.inpiao365.systemArea model = null;
            using (IDataReader dataReader = ExecuteReader(db, dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return model;
        }
    }
}
